//
//  CompanyDetaiVC_iPad.h
//  WRY
//
//  Created by Yang on 11/2/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "SCCharts.h"
#import "MapAnnotation.h"
#import "DatePickerVC_iPad.h"

#import "FocusListVC_iPad.h"
//#import "CommonView_iPad.h"
#import "NSNull+IsEmpty.h"

@protocol CompanyDetaiVC_iPadDelegate

- (void)mapbuttonPressedInDetailPage:(NSDictionary *)proporties;

@end


@class CommonView_iPad;
@interface CompanyDetaiVC_iPad : UIViewController <MKMapViewDelegate,DatePickerVC_iPadDelegate,FocusListVC_iPadDelegate> {
	IBOutlet UIImageView *backgroundImageView;
	IBOutlet UISegmentedControl *leftSeg;
	IBOutlet UISegmentedControl *rightSeg;
	IBOutlet UIButton *focusBt;
	IBOutlet UILabel *companyName;
	IBOutlet UIImageView *focusImageView;
	IBOutlet UITableView *listTable;//企业信息和数据列表
	IBOutlet MKMapView *mapView;
	IBOutlet UIScrollView *factorBtHolder;
	IBOutlet UITableView *subFactorTable;//因子列表
	IBOutlet UIView *maskView;
	IBOutlet UIButton *mapButton;
	
	
	
	
	NSMutableArray *subFactors;//因子列表
	
	NSMutableDictionary *selectedFactorDict;//选中排口及因子
	NSMutableDictionary *infoDict;//基本信息列表
	
	NSMutableArray *factorData;//请求排放口及因子列表
	NSArray *infoKeyArray;//基本信息键值
	NSMutableArray *dataArray;//数据列表
	NSDate *selectDate;//历史数据选中时间
	// 图表
	SC_CurveChartVC *curveController;
	// 集成关注企业VC
	FocusListVC_iPad *focusController;
	UIButton *maskButton; // 覆盖在整个view上，用来禁止一切的点击动作
	
	// activity alert
	UIActivityIndicatorView *activeIndicator;
	UILabel *loadingLabel;
	UIImageView *loadingBackImage;
	
	NSInteger selectedSubFactorRow;
	
	UIPopoverController *popControlller;
	// 代理， 主要用来响应map点击事件
	id<CompanyDetaiVC_iPadDelegate> detaiVCdelegate;
		
	CommonView_iPad *activityView;
	NSString *name;
	NSString *code;
	//
	NSString *marksiteCode;
	NSString *markfactoryCode;
	NSString *marksitetypeCode;
	NSString *markEnterpriseCode;
    NSString *markEnterpriseTypeCode;
	

}


@property(nonatomic,retain) UIImageView *backgroundImageView;
@property(nonatomic,retain) UISegmentedControl *leftSeg;
@property(nonatomic,retain) UISegmentedControl *rightSeg;
@property(nonatomic,retain) UIButton *focusBt;
@property(nonatomic,retain) UILabel *companyName;
@property(nonatomic,retain) UIImageView *focusImageView;
@property(nonatomic,retain) MKMapView *mapView;
@property(nonatomic,retain) UIScrollView *factorBtHolder;
@property(nonatomic,retain) UIView *maskView;
@property(nonatomic,retain) UIButton *mapButton;

@property(nonatomic,retain)CommonView_iPad *activityView;
@property(nonatomic,retain)NSString *name;
@property(nonatomic,retain)NSString *code;
@property(nonatomic,retain)NSString *marksiteCode;
@property(nonatomic,retain)NSString *markfactoryCode;
@property(nonatomic,retain)NSString *marksitetypeCode;
@property(nonatomic,retain)NSString *markEnterpriseCode;
@property(nonatomic,retain)NSString *markEnterpriseTypeCode;


@property(nonatomic,retain)UIPopoverController *popControlller;

@property(nonatomic,assign)id<CompanyDetaiVC_iPadDelegate> detaiVCdelegate;
- (void)showConnectionError;
- (void)showLoading;
- (void)hideLoading;

- (void)requestCompanyInfo;
- (void)requestFactorList;
- (NSString *)timeStringForString:(NSString *)string shortFormat:(BOOL)isShort;
- (void)setMapPorperites;
- (void)reset;
- (void)beginRequestForCompany:(NSString *)companyCode companyTypeCode:(NSString *)companyTypeCode;
- (IBAction)leftSegChanged:(id)sender;
- (IBAction)rightSegChanged:(id)sender;
- (IBAction)focusBtPressed:(id)sender;

- (void)setupFactorBts;

- (void)requestDataForDateTag:(NSInteger )dateTag RowTag:(NSInteger )rowTag;
- (void)reloadChartForArray:(NSArray *)array;

// 集成为关注企业详情页面
- (void)setForFocusDetail;
// mapbutton action
- (IBAction)mapbuttonPressed:(id)sender;
-(NSString *)unitName:(NSString *)factorycode btnTag:(NSInteger)tag;

@end
